package junit;

import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringBeanCase {

	private static ApplicationContext ac = null;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		try {
			ac = new ClassPathXmlApplicationContext("junit/spring-junit.xml");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Test
	public void getBeans() {
		System.out.println("There are " + ac.getBeanDefinitionCount()
				+ " Beans defined.");
		String[] beanNames = ac.getBeanDefinitionNames();
		for (String beanName : beanNames) {
			System.out.println("beanName is : " + beanName);
		}
	}

}
